package com.note.beans;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;

//@Component
//改为用import加载
public class OtherBean {
    @Bean("dataSource")
    public DataSource dataSource(@Value("${jdbc.driver}") String className){
        DruidDataSource druidDataSource = new DruidDataSource();
        //配置数据参数
        druidDataSource.setDriverClassName(className);
        System.out.println(className);
        return druidDataSource;
    }
}
